<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/static/include/taglib.jsp"%>
<!DOCTYPE html >
<html>
<head>
 <meta name="viewport" content="width=device-width" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
 <title>后台管理--模板编辑</title>
 <link href="${ctxStatic}/ligeruilib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css">
 <link href="${ctxStatic}/layui/css/layui.css" rel="stylesheet" />
 <link href="${ctxStatic}/css/kpiuitanchu.css" rel="stylesheet" />
 <script src="${ctxStatic}/js/jquery-1.8.3.min.js?v=2.0" type="text/javascript"></script>

 <script src="${ctxStatic}/layui/layui.all.js"  type="text/javascript"></script>
  <script src="${ctxStatic}/ligeruilib/ligerUI/js/core/base.js" type="text/javascript"></script>
 <script src="${ctxStatic}/ligeruilib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>


<script>
$(function(){
    $("#userid").ligerComboBox(
        {
        	
            url: '../common/get_user_list',
            valueField: 'userid',
            textField: 'realname', 
            selectBoxWidth: 513,
            autocomplete: true,
            keySupport: true,
            valueFieldID:"hid",
            onSelected: function(userid,realname){//id为空值，name为选择的值  
              $("#hiduserid").val(userid);
              var data=$("#userid").ligerGetComboBoxManager().getSelected();
              if(data){
            	  $("#szdw").html("实际工作单位："+data.orgname);
                  $("#rsgx").html("人事关系所在单位："+data.rsgxorgname);
              }
              else{
            	  if($("#hiduserid").val()>0){
            		  $("#szdw").html("实际工作单位："+$("#hidorgname").val());
                      $("#rsgx").html("人事关系所在单位："+$("#hidrsgxorgname").val());
                      $("#userid").attr("disabled","disabled");
            	  }
              }
            }, 
            onSuccess:function(data){
            	$("#userid").ligerGetComboBoxManager().selectValue($("#hiduserid").val());
            },
            width: 515 
        }
    );
   
    
})
</script>
</head>
<body>
<div class="tanchucontent" style="width:90%">
   <form class="layui-form" id="formedit" name="formedit" action="add_vtdpuser" method="post" target="d41d8cd98f00b204e9800998ecf8427e">
    <iframe name="d41d8cd98f00b204e9800998ecf8427e" src="about:blank" style="display:none;"></iframe>
     <table>
      <tr>
       <td class="td_right">人员：</td>
       <td colspan="3">
        <input type="text" id="userid" lay-verify="ruserid" style="padding-left:5px;" class="layui-input">
        <input type="hidden" id="hiduserid" name="userid" value="${entity.userid }">
       </td>
      </tr>
      <tr>
       <td style="text-align: center" colspan="4">
        <font id="szdw"></font>
        <font id="rsgx" style="margin-left:20px"></font>
       </td>
      </tr>
     
      <tr>
       <td class="td_right">特殊事项：</td>
       <td colspan="3">
         <select name="vtdpid" lay-verify="required" id="vtdpid">
                <c:forEach var="item" items="${vtdpitemlst}">
                  <option value="${item.vtdpid}">${item.vtdpname}</option>
                </c:forEach>
         </select>
       </td>
      </tr>
      <tr>
       <td class="td_right">执行开始时间：</td>
       <td style="width:120px">
          <input type="text" id="begintime"   autocomplete="off"  name="begintime" lay-verify="required|date" value="<fmt:formatDate value='${entity.begintime}' pattern='yyyy-MM-dd'/>" class="layui-input">
       </td>
       <td class="td_right" style="width:150px">执行结束时间：</td>
       <td style="width:120px">
          <input type="text" id="endtime" name="endtime" autocomplete="off"  lay-verify="required|date" value="<fmt:formatDate value='${entity.endtime}' pattern='yyyy-MM-dd'/>" class="layui-input">
       </td>
      </tr>
      
      <tr>
       <td class="td_right">说明：</td>
       <td colspan="3">
         <textarea class="layui-textarea"  name="wgwjsm" >${entity.wgwjsm}</textarea>
       </td>
      </tr>
      <tr>
       <td style="text-align: center;height:50px" colspan="4">
         <button class="button" lay-submit="" lay-filter="demo1" id="btnsave">保存</button>
		 <input type="button" value="关闭" class="button" onclick="top.CloseOpenWindow()"/>
       </td>
      </tr>
     </table>
     
      <input type="hidden" id="uservtdpid" name="uservtdpid" value="${entity.uservtdpid }">
 
     </form>
      <input type="hidden" id="hidvtdpid" name="hidvtdpid" value="${entity.vtdpid }">
      <input type="hidden" id="hidorgname" name="orgname" value="${entity.orgname }">
     <input type="hidden" id="hidrsgxorgname" name="rsgxorgname" value="${entity.rsgxorgname }">
  </div>

<script>
layui.use(['form','laydate'], function(){
   var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
   form.verify({
	   ruserid: function(value,demo){
	     if(value==''){
	      return '必填项不能为空';
	     }
	     
	     var sele=$("#hiduserid").val();
	     if(sele==''){
		      return '请选择人员';
		 }
	    
	    }})
	    
	    
	   var laydate = layui.laydate;
	   laydate.render({
		    elem: '#begintime'
	   });
	   laydate.render({
		    elem: '#endtime'
	   });
	   
	   $("#vtdpid").val($("#hidvtdpid").val());
	form.render('select');
	   
   form.render();
});  

function CloseDialog(result,msg){
	  top.frames["iframe"].vUserBcjkh.addresult(result,msg);
}
</script>
</body>
</html>